from django import forms
from captcha.fields import CaptchaField

from .models import UserProfile

# _*_ coding: utf-8 _*_
__author__ = 'xiazi'
__date__ = '2017/7/3 11:13'


class LoginForm(forms.Form):
    username = forms.CharField(required=True, error_messages={'required': '请输入您的账号或者邮箱'})
    password = forms.CharField(required=True, min_length=5)


class RegisterForm(forms.Form):
    email = forms.EmailField(required=True, error_messages={'invalid': '请输入正确的邮箱格式。如：123@qq.com'})
    password = forms.CharField(required=True, min_length=5, error_messages={'invalid': '密码错误'})
    captcha = CaptchaField(error_messages={'invalid': '验证码错误'})


class ForgetForm(forms.Form):
    email = forms.EmailField(required=True)
    captcha = CaptchaField(error_messages={'invalid': '验证码错误'})


class ModifyPwdForm(forms.Form):
    password1 = forms.CharField(required=True, min_length=5)
    password2 = forms.CharField(required=True, min_length=5)


class UploadImageForm(forms.ModelForm):
    class Meta:
        model = UserProfile
        fields = ['image']
